package com.zzb.dao.impl;

import com.zzb.dao.ProductDao;
import com.zzb.entity.ProductEntity;
import com.zzb.util.MyBatisUtils;

import java.util.List;

public class ProductDaoImpl implements ProductDao {
    @Override
    public ProductEntity findByName(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.findByName(productEntity);
    }

    @Override
    public int add(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.add(productEntity);
    }

    @Override
    public int delete(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.delete(productEntity);
    }

    @Override
    public ProductEntity findById(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.findById(productEntity);
    }

    @Override
    public List<ProductEntity> findAll(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.findAll(productEntity);
    }

    @Override
    public int update(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.update(productEntity);
    }

    @Override
    public int count(ProductEntity productEntity) {
        ProductDao productDao = MyBatisUtils.getMapper(ProductDao.class);
        return productDao.count(productEntity);
    }
}
